extends Node2D

# class member variables go here, for example:
# var a = 2
# var b = "textvar"
var startPos=Vector2(400,400)
export var endPos=Vector2()
export var ctrlAPos=Vector2()
var ctrlBPos=Vector2()


func _ready():
	# Called when the node is added to the scene for the first time.
	# Initialization here
	pass

func _physics_process(delta):
	endPos=get_local_mouse_position()
	ctrlAPos.x=startPos.x+(startPos.x-endPos.x)*0.1
	ctrlAPos.y=endPos.y-(endPos.y-startPos.y)*0.2
	ctrlBPos.y=endPos.y+(endPos.y-startPos.y)*0.3
	ctrlBPos.x=startPos.x-(startPos.x-endPos.x)*0.3
	update()
	
	pass
func _draw():
	for i in range(20):
		var t=float(i)/20 
		var pos=startPos*(1-t)*(1-t)*(1-t)+3*ctrlAPos*t*(1-t)*(1-t)+3*ctrlBPos*t*t*(1-t)+endPos*t*t*t
		draw_circle(pos,20,Color(1,1,1,1))
	pass